home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Games: Greatest Hits 1996
/
Amiga Games: Greatest Hits 1996.iso
/
archive
/
userbox
/
publicdomain
/
gedscanner.lha
/
GedScanner
/
HeaderScan.asm
< prev
next >
Wrap
Assembly Source File
|
1996-07-22
|
2KB
|
105 lines
; GoldED scanner for header files
; it recognizes #define, struct and `function` entrys
movem.l a1-a2/d1-d3,-(SP)
move.l d0,d1 ; remember length
moveq.l #0,d0
moveq.l #0,d2
movea.l (a0),a1
cmpi.b #"#",(a1)
beq def ; searching defines...
cmpi.b #" ",(a1)
beq end ; should not start with ' '
cmpi.b #"*",(a1)
beq end ; should not start with '*'
bracket cmpi.b #"/",(a1)
beq struc
cmpi.b #"-",(a1)
beq struc
cmpi.b #"+",(a1)
beq struc
cmpi.b #"(",(a1)+
beq funct
cmp.b d2,d1
beq struc
addq.b #1,d2
bra bracket
funct cmpi.b #0,-(a1) ;
functloop cmpi.b #0,d2
beq end
subq.b #1,d2
cmpi.b #" ",-(a1)
beq functloop
cmpi.b #9,(a1)
bne nameend
bra functloop
nameend move.b d2,d3 ; remember offset
nameloop cmpi.b #0,d2
beq namefini
subq.b #1,d2
cmpi.b #" ",-(a1)
beq namefini
cmpi.b #9,(a1)
beq namefini
cmpi.b #"*",(a1)
beq namefini
bra nameloop
namefini cmpi.b #0,(a1)+
move.l a1,(a0)
move.b d3,d0
sub.b d2,d0
bra end
def lea defstr,a2 ; searching defines
bra search
struc movea.l (a0),a1
moveq.l #0,d0
moveq.l #0,d2
cmpi.b #"s",(a1) ; searching struct
bne end
lea structstr,a2
search cmpi.b #0,(a2)
beq found
cmp.b d2,d1
beq end
addq.l #1,d2
cmpm.b (a2)+,(a1)+
bne end ; nothing found
bra search
found cmp.b d2,d1
beq end
addq.b #1,d2
cmpi.b #" ",(a1)+
beq found
cmpi.b #0,-(a1)
cmpi.b #9,(a1)+
beq found
suba.l #1,a1
move.l a1,(a0) ; namestart
loop cmpi.b #"(",(a1) ; calculate length
beq end
cmpi.b #" ",(a1)
beq end
cmpi.b #10,(a1)
beq end
cmpi.b #9,(a1)+
beq end
addq.l #1,d0
cmp.b d2,d1
beq end
addq.b #1,d2
bra loop
end movem.l (SP)+,a1-a2/d1-d3
rts
defstr dc.b '#define',0
structstr dc.b 'struct',0